Skip to content

Kill the socket discovery helper when its caller cancels - #1375

Closed
bos wants to merge 1 commit into
meta:mainfrom
bos:watchman-client-cancel-socket-discovery
Closed

bos wants to merge 1 commit into
meta:mainfrom
bos:watchman-client-cancel-socket-discovery

Conversation

@bos

@bos bos commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

When a caller times out during Connector::connect(), dropping the socket-discovery future can leave watchman get-sockname running. A caller that retries can leave a new helper running each time the server stalls.

Enable Tokio's kill_on_drop for the socket-discovery command so cancellation kills the helper. The Unix regression test waits for a fake watchman to start, cancels discovery, and verifies that the process goes away. It times out with the original code.

All nine watchman_client library tests and the nightly rustfmt check passed on Linux.

Dropping the get-sockname output future can leave the Watchman CLI running if socket discovery stalls. Enable Tokio kill-on-drop for the subprocess and exercise cancellation with a helper that otherwise stays alive.
@meta-cla meta-cla Bot added the CLA Signed label Nov 20, 2026
@meta-codesync

meta-codesync Bot commented Nov 20, 2026

Copy link
Copy Markdown

This pull request has been imported. If you are a Meta employee, you can view this in D133408172. (Because this pull request was imported automatically, there will not be any future comments.)

@meta-codesync meta-codesync Bot closed this in 8cbd117 Nov 20, 2026
@meta-codesync meta-codesync Bot added the Merged label Nov 20, 2026
@meta-codesync

meta-codesync Bot commented Nov 20, 2026

Copy link
Copy Markdown

@genevievehelsel merged this pull request in 8cbd117.

meta-codesync Bot pushed a commit to meta/sapling that referenced this pull request Nov 20, 2026
Summary:
When a caller times out during `Connector::connect()`, dropping the socket-discovery future can leave `watchman get-sockname` running. A caller that retries can leave a new helper running each time the server stalls.

Enable Tokio's `kill_on_drop` for the socket-discovery command so cancellation kills the helper. The Unix regression test waits for a fake `watchman` to start, cancels discovery, and verifies that the process goes away. It times out with the original code.

All nine `watchman_client` library tests and the nightly rustfmt check passed on Linux.

X-link: meta/watchman#1375

Reviewed By: SBones

Differential Revision: D133408172

Pulled By: genevievehelsel

fbshipit-source-id: 1f8113e6c96af4f9cad2ae16311ee66c01e8c8ef
meta-codesync Bot pushed a commit to meta/hhvm that referenced this pull request Nov 20, 2026
Summary:
When a caller times out during `Connector::connect()`, dropping the socket-discovery future can leave `watchman get-sockname` running. A caller that retries can leave a new helper running each time the server stalls.

Enable Tokio's `kill_on_drop` for the socket-discovery command so cancellation kills the helper. The Unix regression test waits for a fake `watchman` to start, cancels discovery, and verifies that the process goes away. It times out with the original code.

All nine `watchman_client` library tests and the nightly rustfmt check passed on Linux.

X-link: meta/watchman#1375

Reviewed By: SBones

Differential Revision: D133408172

Pulled By: genevievehelsel

fbshipit-source-id: 1f8113e6c96af4f9cad2ae16311ee66c01e8c8ef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant